-
Notifications
You must be signed in to change notification settings - Fork 6
User Organization Clean up #3529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes update the process of assigning and removing organizations from users by renaming input properties, restructuring output types to include partner details, and adding new methods to retrieve a user's primary organization. The resolver and service layers are enhanced to support these updates, including new dependencies and resolve fields. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🗞 GraphQL SummaryView schema changes@@ -28,13 +28,13 @@
userId: ID!
}
input AssignOrganizationToUserInput {
- request: AssignOrganizationToUser!
+ assignment: AssignOrganizationToUser!
}
type AssignOrganizationToUserOutput {
- success: Boolean! @deprecated(reason: "This operation will not return if there is a failure.\nCheck the errors instead of using this field.\nIf you need to reference a field in the output use `__typename` instead.\nThis field will go away at any point in time without warning.")
+ partner: Partner!
}
type Audio implements Media & TemporalMedia {
"""
@@ -5454,13 +5454,13 @@
userId: ID!
}
input RemoveOrganizationFromUserInput {
- request: RemoveOrganizationFromUser!
+ assignment: RemoveOrganizationFromUser!
}
type RemoveOrganizationFromUserOutput {
- success: Boolean! @deprecated(reason: "This operation will not return if there is a failure.\nCheck the errors instead of using this field.\nIf you need to reference a field in the output use `__typename` instead.\nThis field will go away at any point in time without warning.")
+ partner: Partner!
}
input RenameFileInput {
"""The file node's ID"""
@@ -8014,8 +8014,9 @@
phone: SecuredStringNullable!
"""Does the requesting user have this pinned?"""
pinned: Boolean!
+ primaryOrganization: Partner
projects(input: ProjectListInput = {count: 25, order: ASC, page: 1, sort: "name"}): SecuredProjectList!
realFirstName: SecuredString!
realLastName: SecuredString!
roles: SecuredRoles!
🚨 Breaking Changes
|
f4bc19a
to
41532b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/user/user.gel.repository.ts (1)
88-90
: LGTM! Placeholder method maintains interface consistency.The addition of
getPrimaryOrganizationId
correctly maintains interface consistency withUserRepository
by implementing thePublicOf<UserRepository>
contract. TheNotImplementedException
with userId context is appropriate for the GEL repository placeholder implementation.Consider adding a TODO comment to track that this functionality needs implementation:
+ // TODO: Implement getPrimaryOrganizationId for GEL repository getPrimaryOrganizationId(userId: ID): Promise<ID | null> { throw new NotImplementedException().with({ userId }); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/components/user/dto/assign-organization-to-user.dto.ts
(2 hunks)src/components/user/dto/remove-organization-from-user.dto.ts
(2 hunks)src/components/user/user.gel.repository.ts
(1 hunks)src/components/user/user.repository.ts
(2 hunks)src/components/user/user.resolver.ts
(5 hunks)src/components/user/user.service.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- src/components/user/user.resolver.ts
- src/components/user/user.service.ts
- src/components/user/dto/assign-organization-to-user.dto.ts
- src/components/user/dto/remove-organization-from-user.dto.ts
- src/components/user/user.repository.ts
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CarsonF
PR: SeedCompany/cord-api-v3#3377
File: src/components/partner/partner.repository.ts:184-191
Timestamp: 2025-04-03T15:07:44.087Z
Learning: In the Partner repository, when updating a departmentIdBlock, null is intentionally passed to departmentIdBlockUtils.set() to clear the current value. The condition should remain departmentIdBlock !== undefined to allow null to be passed through.
🧬 Code Graph Analysis (1)
src/components/user/user.gel.repository.ts (1)
src/common/id-field.ts (1)
ID
(24-25)
Added a new GraphQL resolver field
primaryOrganization
to theUser
type that returns the user's primary organization as aPartner
object.Fixed a bug in the organization assignment logic where setting a new primary organization wouldn't properly override the existing one.
Updated the
assignOrganizationToUser
mutation to usereadOnePartnerByOrgId
and return the relatedPartner
.Updated the
removeOrganizationFromUser
mutation to usereadOnePartnerByOrgId
and return the relatedPartner
.